<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">


  <script>
  (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0f81ff2f.js","daovoice")
  daovoice('init', {
      app_id: "15fc8e87"
    });
  daovoice('update');
  </script>






  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.3.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.3.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.3.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.3.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="自己开发编写的一套简单易用的Java爬虫框架，轻轻松松帮你抓取数据">
<meta name="keywords" content="Java,爬虫,开源,工具">
<meta property="og:type" content="article">
<meta property="og:title" content="一套简单的java爬虫框架VW-Crawler发布啦！！！">
<meta property="og:url" content="http://blog.wangxc.club/2018/07/19/1/index.html">
<meta property="og:site_name" content="冬与晨">
<meta property="og:description" content="自己开发编写的一套简单易用的Java爬虫框架，轻轻松松帮你抓取数据">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://img.shields.io/maven-central/v/com.github.vector4wang/vw-crawler.svg">
<meta property="og:image" content="https://i.loli.net/2018/04/03/5ac333ab0021a.png">
<meta property="og:image" content="https://img.shields.io/badge/CSDN-@%E7%88%86%E7%B1%B3%E8%8A%B1%E6%9C%BA%E6%9E%AA%E6%89%8B-red.svg">
<meta property="og:image" content="https://img.shields.io/badge/BLOG-@%E5%86%AC%E4%B8%8E%E6%99%A8-lightgrey.svg">
<meta property="og:image" content="https://img.shields.io/badge/%E7%AE%80-@%E5%86%AC%E4%B8%8E%E6%99%A8-E9705E.svg">
<meta property="og:image" content="https://img.shields.io/badge/Github-@vector4wang-25292E.svg">
<meta property="og:image" content="https://img.shields.io/badge/%E7%A0%81%E4%BA%91-@BMHJQS-C5212A.svg">
<meta property="og:updated_time" content="2018-07-19T14:32:22.577Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="一套简单的java爬虫框架VW-Crawler发布啦！！！">
<meta name="twitter:description" content="自己开发编写的一套简单易用的Java爬虫框架，轻轻松松帮你抓取数据">
<meta name="twitter:image" content="https://img.shields.io/maven-central/v/com.github.vector4wang/vw-crawler.svg">






  <link rel="canonical" href="http://blog.wangxc.club/2018/07/19/1/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>一套简单的java爬虫框架VW-Crawler发布啦！！！ | 冬与晨</title>
  




<script async src="https://www.googletagmanager.com/gtag/js?id=UA-102769182-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-102769182-1');
</script>



  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?809d5610fca8eaff344d9a698536110d";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband">
    </div>
<a href="https://github.com/vector4wang"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">冬与晨</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">
    <a href="/404/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>公益 404</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.wangxc.club/2018/07/19/1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="wangxc">
      <meta itemprop="description" content="革命尚未成功，同志还需努力~">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="冬与晨">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">一套简单的java爬虫框架VW-Crawler发布啦！！！
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-07-19 22:19:34 / 修改时间：22:32:22" itemprop="dateCreated datePublished" datetime="2018-07-19T22:19:34+08:00">2018-07-19</time>
            

            
              

              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/技术/" itemprop="url" rel="index"><span itemprop="name">技术</span></a></span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2018/07/19/1/#comments" itemprop="discussionUrl">
                  <span class="post-meta-item-text">评论数：</span> <span class="post-comments-count valine-comment-count" data-xid="/2018/07/19/1/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>自己开发编写的一套简单易用的Java爬虫框架，轻轻松松帮你抓取数据</p>
<a id="more"></a>

<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="86" src="//music.163.com/outchain/player?type=2&id=128669&auto=1&height=66"></iframe>

<h1 id="VW-Crawler"><a href="#VW-Crawler" class="headerlink" title="VW-Crawler"></a>VW-Crawler</h1><p><img src="https://img.shields.io/maven-central/v/com.github.vector4wang/vw-crawler.svg" alt="Central"></p>
<h2 id="背景"><a href="#背景" class="headerlink" title="背景"></a>背景</h2><p>自己一直对爬虫比较感兴趣，大学的毕业论文也是一个爬虫项目(爬教务处信息，然后做了个Android版教务管理系统，还获得了优秀毕业设计的称号)，自那以后遇到自己感兴趣的网站就会去抓一下。前段时间工作上需要一些JD信息，我就从网上找了个开源的爬虫框架WebMagic，使用简单，易配置，功能也很强大，当然了也有些网站的数据不适合使用。前前后后写了不下十几个，慢慢的就想是不是可以把这些爬虫代码再抽象出来，做出一个简易的爬虫框架呢？于是就尝试去看WebMagic的源码，后来又发现了一个源码比较容易解读的爬虫框架XXL-CRAWLER,简单的分析了源码之后，开发自己一套爬虫框架的欲望更加强烈,于是在2017年底的时候就开始了开发，中间断断续续得停了写，写了停。直到最近8月底的时候才算出了一个版本，然后顺势把它放到了Maven公服仓库上。一个人的力量很薄弱，要想完善这个爬虫的健壮性、可用性和易扩展性还需要大家的力量！</p>
<h2 id="特点"><a href="#特点" class="headerlink" title="特点"></a>特点</h2><ul>
<li>语言: Java开发，框架比较简单，多处使用的是接口编程，是学习Java不错的例子</li>
<li>难度: 及其简单，配置一下，写个解析逻辑，整理下保存方法，就OK了</li>
<li>轻量: 使用Jsoup做默认的下载器，依赖性较低</li>
<li>线程: 可自主<strong>设置线程</strong>数抓取，提高抓取效率</li>
<li>重试: 支持失败重试，次数可以自定义</li>
<li>代理: 支持配置<strong>代理池</strong>，默认随机使用代理IP，也可自定义算法获取</li>
<li>去重: <strong>双重去重</strong>，默认对URL去重，也可以定义第二层去重逻辑</li>
<li>控制: 可<strong>自主控制</strong>是否需要解析页面，减少资源的使用</li>
<li>精准: 通过设置URL的正则来<strong>精准</strong>的解析每一个URL</li>
<li>扩展: 几乎每一个环节都可以自定义</li>
</ul>
<h2 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h2><h3 id="使用Maven"><a href="#使用Maven" class="headerlink" title="使用Maven"></a>使用Maven</h3><p>在<a href="http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.github.vector4wang%22" target="_blank" rel="noopener">http://search.maven.org</a>上使用最新的版本<br>在pom中引入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&lt;dependency&gt;</span><br><span class="line">    &lt;groupId&gt;com.github.vector4wang&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;vw-crawler&lt;/artifactId&gt;</span><br><span class="line">    &lt;version&gt;$&#123;last.version&#125;&lt;/version&gt;</span><br><span class="line">&lt;/dependency&gt;</span><br></pre></td></tr></table></figure>

<h3 id="离线使用"><a href="#离线使用" class="headerlink" title="离线使用"></a>离线使用</h3><p>可以在项目主页的<a href="https://github.com/vector4wang/vw-crawler/releases" target="_blank" rel="noopener">release</a>下载最新版本jar，然后导入自己的项目中。</p>
<h2 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h2><ul>
<li>配置参数</li>
<li>抽象正则</li>
<li>解析页面</li>
<li>保存数据</li>
</ul>
<p>各环节均支持自定义</p>
<h2 id="示例"><a href="#示例" class="headerlink" title="示例"></a>示例</h2><h3 id="抓取CSDN某用户的博客内容"><a href="#抓取CSDN某用户的博客内容" class="headerlink" title="抓取CSDN某用户的博客内容"></a>抓取CSDN某用户的博客内容</h3><p>设置爬虫的基本配置，如User-Agent、起始地址、目标页面的url正则表达式、线程数和超时时间等</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br></pre></td><td class="code"><pre><span class="line">new VWCrawler.Builder()</span><br><span class="line">        // 配置参数</span><br><span class="line">        .setHeader(&quot;User-Agent&quot;,</span><br><span class="line">                &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36&quot;) // 设置请求头</span><br><span class="line">        .setUrl(&quot;https://blog.csdn.net/qqhjqs&quot;) // 设置爬虫起始地址</span><br><span class="line">        .setThreadCount(10) // 设置几个线程抓取数据</span><br><span class="line">        .setTimeOut(5000) // 设置超时时间</span><br><span class="line"></span><br><span class="line">        // 抽象正则</span><br><span class="line">        .setTargetUrlRex(&quot;https://blog.csdn.net/qqhjqs/article/details/[0-9]+&quot;) // 设置目标页面url的正则表达式</span><br><span class="line"></span><br><span class="line">        // 解析页面</span><br><span class="line">        .setPageParser(new CrawlerService&lt;Blog&gt;() &#123;</span><br><span class="line"></span><br><span class="line">            /**</span><br><span class="line">             * 有的url可能在某个场景下不需要可在此处理</span><br><span class="line">             * 默认返回false，可以不做处理</span><br><span class="line">             * @param url 即将要抓取的url</span><br><span class="line">             * @return</span><br><span class="line">             */</span><br><span class="line">            @Override</span><br><span class="line">            public boolean isExist(String url) &#123;</span><br><span class="line">                if (&quot;https://blog.csdn.net/qqhjqs/article/details/79101846&quot;.equals(url)) &#123;</span><br><span class="line">                    return true;</span><br><span class="line">                &#125;</span><br><span class="line">                return false;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">            /**</span><br><span class="line">             * 有的页面有WAF，可以再真正解析前，做个判断，遇到特殊标志的直接可以跳过</span><br><span class="line">             * 默认返回true，可以不做处理</span><br><span class="line">             * @param document 即将要解析的document</span><br><span class="line">             * @return</span><br><span class="line">             */</span><br><span class="line">            @Override</span><br><span class="line">            public boolean isContinue(Document document) &#123;</span><br><span class="line">                if (&quot;最近和未来要做的事 - CSDN博客&quot;.equals(document.title())) &#123;</span><br><span class="line">                    System.out.println(&quot;模拟遇到WAF此页面不做解析&quot;);</span><br><span class="line">                    return false;</span><br><span class="line">                &#125;</span><br><span class="line">                return true;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">            /**</span><br><span class="line">             * 目标页面的doc对象，还有通过注解处理后的对象</span><br><span class="line">             * @param doc 文档内容</span><br><span class="line">             * @param pageObj 封装的对象</span><br><span class="line">             */</span><br><span class="line">            @Override</span><br><span class="line">            public void parsePage(Document doc, Blog pageObj) &#123;</span><br><span class="line">                // 可进行二次处理</span><br><span class="line">                pageObj.setReadNum(pageObj.getReadNum().replace(&quot;阅读数：&quot;, &quot;&quot;));</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">            // 保存数据</span><br><span class="line"></span><br><span class="line">            /**</span><br><span class="line">             * 可以做保存对象的处理</span><br><span class="line">             * @param pageObj 页面对象</span><br><span class="line">             */</span><br><span class="line">            @Override</span><br><span class="line">            public void save(Blog pageObj) &#123;</span><br><span class="line">                System.out.println(&quot;save blog summery: &quot; + pageObj.toString());</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;) // 自定义解析service</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        .build().start(); // 启动</span><br></pre></td></tr></table></figure>

<p>配置页面数据对象的注解</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">@CssSelector(selector = &quot;#mainBox &gt; main &gt; div.blog-content-box &gt; div.article-title-box &gt; h1&quot;, resultType = SelectType.TEXT)</span><br><span class="line">private String title;</span><br><span class="line"></span><br><span class="line">@CssSelector(selector = &quot;#mainBox &gt; main &gt; div.blog-content-box &gt; div.article-info-box &gt; div &gt; span.time&quot;, dateFormat = &quot;yyyy年MM月dd日 HH:mm:ss&quot;)</span><br><span class="line">private Date lastUpdateDate;</span><br><span class="line"></span><br><span class="line">@CssSelector(selector = &quot;#mainBox &gt; main &gt; div.blog-content-box &gt; div.article-info-box &gt; div &gt; div &gt; span&quot;, resultType = SelectType.TEXT)</span><br><span class="line">private String readNum;</span><br></pre></td></tr></table></figure>

<p>这里使用比较流行的注解方式，通过cssselector来获取节点数据可通过resultType来指定填充的是text还是html。</p>
<p>随便配置一下，就能抓取一个页面的数据</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">new VWCrawler.Builder().setUrl(&quot;https://www.qiushibaike.com/&quot;).setPageParser(new CrawlerService() &#123;</span><br><span class="line">    @Override</span><br><span class="line">    public void parsePage(Document doc, Object pageObj) &#123;</span><br><span class="line">        System.out.println(doc.toString());</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    @Override</span><br><span class="line">    public void save(Object pageObj) &#123;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;).build().start();</span><br></pre></td></tr></table></figure>

<h2 id="更多"><a href="#更多" class="headerlink" title="更多"></a>更多</h2><p>更多的示例可移步<a href="https://github.com/vector4wang/vw-crawler/tree/master/src/test/java" target="_blank" rel="noopener">more</a></p>
<p>抓取了足够多的数据，我们可以拿数据做很多事，比如统计各大人才网的职位分布图<br><a href="https://i.loli.net/2018/04/03/5ac333ab0021a.png" target="_blank" rel="noopener"><img src="https://i.loli.net/2018/04/03/5ac333ab0021a.png" alt="职位分布图"></a><br>有关ES的可移步<a href="https://github.com/vector4wang/elasticsearch-quick" target="_blank" rel="noopener">这里</a></p>
<h2 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h2><p>轮子造多了就想着造一个模具，代码写多了就想写个框架，一样的道理。帮助他人，顺便提升自己。框架还有很多需要完善的地方，希望使用者多多提issue，也希望大家提PR<del>~</del></p>
<p><a href="https://github.com/vector4wang/vw-crawler" target="_blank" rel="noopener">源码</a></p>
<p>欢迎大家访问<br><a href="http://blog.csdn.net/qqhjqs?viewmode=list" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/CSDN-@%E7%88%86%E7%B1%B3%E8%8A%B1%E6%9C%BA%E6%9E%AA%E6%89%8B-red.svg" alt></a> <a href="http://blog.wangxc.club"><img src="https://img.shields.io/badge/BLOG-@%E5%86%AC%E4%B8%8E%E6%99%A8-lightgrey.svg" alt></a> <a href="https://www.jianshu.com/u/223a1314e818" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/%E7%AE%80-@%E5%86%AC%E4%B8%8E%E6%99%A8-E9705E.svg" alt></a> <a href="https://github.com/vector4wang" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/Github-@vector4wang-25292E.svg" alt></a> <a href="https://gitee.com/backwxc" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/%E7%A0%81%E4%BA%91-@BMHJQS-C5212A.svg" alt></a></p>

      
    </div>

    

    
    
    

    <div>
          
            
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/2018/07/19/1/">一套简单的java爬虫框架VW-Crawler发布啦！！！</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 wangxc 的个人博客">wangxc</a></p>
  <p><span>发布时间:</span>2018年07月19日 - 22:07</p>
  <p><span>最后更新:</span>2018年07月19日 - 22:07</p>
  <p><span>原始链接:</span><a href="/2018/07/19/1/" title="一套简单的java爬虫框架VW-Crawler发布啦！！！">http://blog.wangxc.club/2018/07/19/1/</a>
    <span class="copy-path" title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="http://blog.wangxc.club/2018/07/19/1/" aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
    $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
	});
    });  
</script>

          
    </div>

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="https://i.loli.net/2017/12/29/5a4632028eaeb.jpg" alt="wangxc 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="https://i.loli.net/2017/12/29/5a46320234b1d.jpg" alt="wangxc 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">
              -------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------
        </div>
    
</div>

  
</div>
    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Java/" rel="tag"><i class="fa fa-tag"></i> Java</a>
          
            <a href="/tags/爬虫/" rel="tag"><i class="fa fa-tag"></i> 爬虫</a>
          
            <a href="/tags/开源/" rel="tag"><i class="fa fa-tag"></i> 开源</a>
          
            <a href="/tags/工具/" rel="tag"><i class="fa fa-tag"></i> 工具</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/07/08/1/" rel="next" title="发布自己的jar到Maven Repository公服上">
                <i class="fa fa-chevron-left"></i> 发布自己的jar到Maven Repository公服上
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/07/22/1/" rel="prev" title="使用SpringBoot和VW-Crawler轻松抓取CSDN的文章">
                使用SpringBoot和VW-Crawler轻松抓取CSDN的文章 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="wangxc">
            
              <p class="site-author-name" itemprop="name">wangxc</p>
              <p class="site-description motion-element" itemprop="description">革命尚未成功，同志还需努力~</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">83</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">6</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">124</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/vector4wang" target="_blank" title="GitHub" rel="external nofollow"><i class="fa fa-fw fa-github"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="mailto:vector4wang@qq.com" target="_blank" title="E-Mail" rel="external nofollow"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.jianshu.com/u/223a1314e818" target="_blank" title="简书" rel="external nofollow"><i class="fa fa-fw fa-book"></i>简书</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://blog.csdn.net/qqhjqs?viewmode=contents" target="_blank" title="CSDN" rel="external nofollow"><i class="fa fa-fw fa-crosshairs"></i>CSDN</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://twitter.com/BMHJQS" target="_blank" title="Twitter" rel="external nofollow"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.facebook.com/" target="_blank" title="FB Page" rel="external nofollow"><i class="fa fa-fw fa-facebook-official"></i>FB Page</a>
                  
                </span>
              
            </div>
          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#VW-Crawler"><span class="nav-number">1.</span> <span class="nav-text">VW-Crawler</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#背景"><span class="nav-number">1.1.</span> <span class="nav-text">背景</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#特点"><span class="nav-number">1.2.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用"><span class="nav-number">1.3.</span> <span class="nav-text">使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#使用Maven"><span class="nav-number">1.3.1.</span> <span class="nav-text">使用Maven</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#离线使用"><span class="nav-number">1.3.2.</span> <span class="nav-text">离线使用</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#步骤"><span class="nav-number">1.4.</span> <span class="nav-text">步骤</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#示例"><span class="nav-number">1.5.</span> <span class="nav-text">示例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#抓取CSDN某用户的博客内容"><span class="nav-number">1.5.1.</span> <span class="nav-text">抓取CSDN某用户的博客内容</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#更多"><span class="nav-number">1.6.</span> <span class="nav-text">更多</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#最后"><span class="nav-number">1.7.</span> <span class="nav-text">最后</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">wangxc</span>

  

  
</div>


  


<div class="powered-by">
<i class="fa fa-user-md"></i><span id="busuanzi_container_site_pv">
  本站访客数:<span id="busuanzi_value_site_uv"></span>
</span>
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" rel="external nofollow" href="https://hexo.io">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" rel="external nofollow" href="https://theme-next.org">NexT.Mist</a> v6.3.0</div>




        








        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.3.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.3.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.3.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.3.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.3.0"></script>



  



	





  





  








  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  
  
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(function (item) {
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: 'YdGFHBfuDwObik8qwCeRAWgr-gzGzoHsz',
        appKey: 'oFpbJwmMQf98DfFDUlzE5Fai',
        placeholder: 'Just go go',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
